/**
 * Copyright (c) 2014 zhenrongbao.com, Inc. All Rights Reserved
 * @author: jiangshuguang
 * @Date  : 14-11-14
 * @Time  : 下午2:55
 * @brief :
 */
(function () {
    var Digital = require('index:widget/ui/digital/digital.js').Digital,
        $page = $('.index-term'),
        term1 = P.data('term1_usable_amount'),
        term3 = P.data('term3_usable_amount'),
        term6 = P.data('term6_usable_amount');

//    if($.browser.msie){
//        window.scrollTo(0,0);
//    }else{
//        $('body').animate({scrollTop:850},500);
//    }

    $page.find('.one-block').click(function(){
        if(!$(this).hasClass('product-disable')){
            location.href="/user/buyterm1";
        }
    });

    $page.find('.three-block').click(function(){
        if(!$(this).hasClass('product-disable')){
            location.href="/user/buyterm3";
        }
    });

    new Digital({
        'container':$page.find(".term1 .credit"),
        'number':term1,
        'type':'min'
    });

    new Digital({
        'container':$page.find(".term3 .credit"),
        'number':term3,
        'type':'min'
    });

    new Digital({
        'container':$page.find(".term6 .credit"),
        'number':term6,
        'type':'min'
    });

})();